import { fetcher } from '@/src/utils/fetcher'
import { cookies } from 'next/headers'
import CaseItem from '@/src/app/components/case'

const Page: React.FC = async () => {
  const cookieStore = cookies()
  const cases = await fetcher<News[]>('/api/index/indexContent?type=case', {
    cookieStore,
  })

  return (
    <>
      {cases.map((item) => {
        return (
          <CaseItem
            key={item.id}
            id={item.id.toString()}
            picture={item.image}
            title={item.title}
            desc={item.con}
          />
        )
      })}
    </>
  )
}

export default Page
